package com.hundsun.yr.universal.library.base;

import android.os.Bundle;
import android.support.v7.widget.Toolbar;

import com.hundsun.yr.universal.library.R;
import com.hundsun.yr.universal.library.utils.ThemeUtils;

public abstract class BaseCaptureActivity extends BaseAppCompatActivity{

	protected Toolbar mToolbar;

	@SuppressWarnings("deprecation")
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		if (isApplyKitKatTranslucency()) {
			setSystemBarTintDrawable(getResources().getDrawable(ThemeUtils.getStatusbar_color()));
		}
		
	}
	
	public void setContentView(int layoutResID) {
		super.setContentView(layoutResID);
		mToolbar = (Toolbar)findViewById(R.id.common_toolbar);
		if (null != mToolbar) {
			setSupportActionBar(mToolbar);
			getSupportActionBar().setHomeButtonEnabled(true);
			getSupportActionBar().setDisplayHomeAsUpEnabled(true);
		}
	}
	
	
	@Override
	protected int configTheme() {
		// TODO Auto-generated method stub
//		int theme = ThemeUtils.themeArr[ThemeUtils.getThemeColorIndex()][0];
		int theme=ThemeUtils.getTheme();
		if (theme > 0)
			return theme;
		return super.configTheme();
	}
	
	/**
	 * 是否改变状态栏背景
	 * @return
	 */
	protected abstract boolean isApplyKitKatTranslucency();
	

}
